package com.salton123.charging.util;

import android.media.MediaPlayer;

public class TrackingMediaPlayer extends MediaPlayer {
    private OnStopListener listener;

    public interface OnStopListener {
        void onStop();
    }

    public void setOnStopListener(OnStopListener onStopListener) {
        this.listener = onStopListener;
    }

    public void stop() throws IllegalStateException {
        OnStopListener onStopListener = this.listener;
        if (onStopListener != null) {
            onStopListener.onStop();
        }
        super.stop();
    }
}
